#!/usr/bin/python

import math
from eulerlib import number;


nlimit=1000000;


def gentotientlist(limit):
	sieve=range(limit+1);
	
	sieve[1]=0;

	for x in xrange(2,limit):
		if sieve[x]==x:# x is prime
			sieve[x]=x-1.0;
			mult=(1.0-1.0/x);
			y=x+x;
			while(y<=limit):
				sieve[y]*=mult;
				y+=x;
	return sieve;




def euler72():
	return sum(gentotientlist(nlimit));

print euler72();

